how to find sum of digits in javascript